﻿@model StoreManager.Models.ImportOrder

@{
    var importDetail = new StoreManager.Models.ImportOrderDetail();
    ViewBag.Title = "Nhập Hàng";
}

<h2>Create</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>ImportOrder</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.ImportOrderNo)
        </div>
        <div class="editor-field">
              @Html.EditorFor(model => model.ImportOrderNo)
            @Html.ValidationMessageFor(model => model.ImportOrderNo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StaffID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StaffID)
            @Html.ValidationMessageFor(model => model.StaffID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Type)
        </div>
        <div class="editor-field">
            @Html.DropDownList("Type")
            @Html.ValidationMessageFor(model => model.Type)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.SupplierID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SupplierID)
            @Html.ValidationMessageFor(model => model.SupplierID)
        </div>
        <table>
             <tr>
                <td>@Html.DisplayNameFor(i => importDetail.Type)</td>
                <td>@Html.DisplayNameFor(i => importDetail.ProductID)</td>
                <td>@Html.DisplayNameFor(i => importDetail.Quantity)</td>
                <td>@Html.DisplayNameFor(i => importDetail.Price)</td>
                <td></td>
            </tr>
           @for(int i = 0; i < @Model.ImportOrderDetails.Count; i++) {
            <tr>
                <td>@Html.DropDownList("Type")
                     @Html.ValidationMessageFor(model => model.ImportOrderDetails[i].Type)
                </td>
                <td> @Html.DropDownList("ProductID")
                     @Html.ValidationMessageFor(model => model.ImportOrderDetails[i].ProductID)
                </td>
                <td>@Html.EditorFor(model => model.ImportOrderDetails[i].Quantity)
                     @Html.ValidationMessageFor(model => model.ImportOrderDetails[i].Quantity)</td>
                <td>@Html.EditorFor(model => model.ImportOrderDetails[i].Price)
                     @Html.ValidationMessageFor(model => model.ImportOrderDetails[i].Price)
                </td>
                <td>@Html.ActionLink("Xóa", "Remove")</td>
            </tr>
           }
             <tr>
                <td></td>
                <td></td>
                <td></td>
                <td><input type="submit" name="Add" value="Add" /></td>
                <td></td>
            </tr>
        </table>   
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
